<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
	.KEYW {color: #933;}
	.COMM {color: #bbb; font-style: italic;}
	.NUMB {color: #393;}
	.STRN {color: #393;}
	.REGX {color: #339;}
	.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
	</style></head><body><pre><span class='line'>  1</span> <span class="COMM">/**
<span class='line'>  2</span>  * @fileOverview 공통 > 기사 스크랩 처리 
<span class='line'>  3</span>  * @author qpitlove, oz_moon
<span class='line'>  4</span>  */</span><span class="WHIT">
<span class='line'>  5</span> </span><span class="NAME">nhn</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">window.nhn</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>  6</span> </span><span class="NAME">nhn.newsstand</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">nhn.newsstand</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>  7</span> </span><span class="NAME">nhn.newsstand.common</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">nhn.newsstand.common</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>  8</span> </span><span class="NAME">nhn.newsstand.common.ScrapArticle</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$Class</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>  9</span> </span><span class="WHIT">	</span><span class="WHIT">
<span class='line'> 10</span> </span><span class="WHIT">	</span><span class="COMM">/** @lends nhn.newsstand.common.ScrapArticle.prototype */</span><span class="WHIT">
<span class='line'> 11</span> </span><span class="WHIT">	</span><span class="NAME">API_SCRAP</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"/api/scrap/create.json"</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 12</span> </span><span class="WHIT">	</span><span class="NAME">sArticleId</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 13</span> </span><span class="WHIT">	</span><span class="WHIT">
<span class='line'> 14</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'> 15</span> 	 * nhn.newsstand.common.ScrapArticle 클래스의 인스턴스를 생성한다.  
<span class='line'> 16</span> 	 * @constructs
<span class='line'> 17</span> 	 * @class 공통 > 기사 스크랩 처리
<span class='line'> 18</span> 	 * @requires nhn.newsstand.common.util
<span class='line'> 19</span> 	 * @requires nhn.newsstand.common.ScrapArticle.oHTML
<span class='line'> 20</span> 	 * @requires nhn.newsstand.common.PopupLayer
<span class='line'> 21</span> 	 * @see nhn.newsstand.common.Purchase
<span class='line'> 22</span> 	 * @param {Instance} oPurchase 구매 안내 레이어 인스턴스 
<span class='line'> 23</span> 	 * @example
<span class='line'> 24</span> 	 * var oScrap = new nhn.newsstand.common.ScrapArticle( oPurchase );
<span class='line'> 25</span> 	 */</span><span class="WHIT">
<span class='line'> 26</span> </span><span class="WHIT">	</span><span class="NAME">$init</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">oPurchase</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 27</span> </span><span class="WHIT">		</span><span class="NAME">this._oPurchase</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">oPurchase</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="WHIT">
<span class='line'> 28</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 29</span> </span><span class="WHIT">	</span><span class="WHIT">
<span class='line'> 30</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'> 31</span> 	 * nhn.newsstand.common.PopupLayer 초기화
<span class='line'> 32</span> 	 */</span><span class="WHIT">
<span class='line'> 33</span> </span><span class="WHIT">	</span><span class="NAME">_initPopupLayer</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 34</span> </span><span class="WHIT">		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">this._oPopup</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 35</span> </span><span class="WHIT">			</span><span class="NAME">this._oPopup</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">nhn.newsstand.common.PopupLayer.getIns</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 36</span> </span><span class="WHIT">			</span><span class="NAME">this._elLayer</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._oPopup.getLayer</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 37</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 38</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 39</span> </span><span class="WHIT">	</span><span class="WHIT">
<span class='line'> 40</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'> 41</span> 	 * 스크랩하기 레이어 구성을 시작한다.
<span class='line'> 42</span> 	 */</span><span class="WHIT">
<span class='line'> 43</span> </span><span class="WHIT">	</span><span class="NAME">_initContent</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 44</span> </span><span class="WHIT">		</span><span class="NAME">this._elLayer.innerHTML</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">nhn.newsstand.common.ScrapArticle.oHTML</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 45</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 46</span> </span><span class="WHIT">	</span><span class="WHIT">
<span class='line'> 47</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'> 48</span> 	 * 서버에 스크랩하기를 요청한다.
<span class='line'> 49</span> 	 */</span><span class="WHIT">
<span class='line'> 50</span> </span><span class="WHIT">	</span><span class="NAME">_requestScrapArticle</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">sArticleId</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 51</span> </span><span class="WHIT">		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">sArticleId</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 52</span> </span><span class="WHIT">		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">this._oAjax</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">this._oAjax.isIdle</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 53</span> </span><span class="WHIT">		</span><span class="WHIT">
<span class='line'> 54</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 55</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">oParams</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">articleId</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">sArticleId</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 56</span> </span><span class="WHIT">		</span><span class="NAME">this._oAjax</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">oUtil.requestData</span><span class="PUNC">(</span><span class="NAME">this.API_SCRAP</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">oParams</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 57</span> </span><span class="WHIT">			</span><span class="NAME">method</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"post"</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 58</span> </span><span class="WHIT">			</span><span class="NAME">loadCallback</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">oResult</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 59</span> </span><span class="WHIT">				</span><span class="NAME">self._initContent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 60</span> </span><span class="WHIT">				</span><span class="NAME">self._oPopup.show</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 61</span> </span><span class="WHIT">			</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 62</span> </span><span class="WHIT">			</span><span class="NAME">errorCallback</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">oError</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 63</span> </span><span class="WHIT">				</span><span class="KEYW">switch</span><span class="PUNC">(</span><span class="NAME">oError.code</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 64</span> </span><span class="WHIT">				</span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">"api.common.require.login"</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="WHIT">
<span class='line'> 65</span> </span><span class="WHIT">					</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">confirm</span><span class="PUNC">(</span><span class="NAME">oError.msg</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">oUtil.gotoLoginPage</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 66</span> </span><span class="WHIT">					</span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 67</span> </span><span class="WHIT">				</span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">"api.common.reqiure.purchase"</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT">
<span class='line'> 68</span> </span><span class="WHIT">					</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">sPurchaseId</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sArticleId</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 69</span> </span><span class="WHIT">					</span><span class="NAME">self._oPurchase.show</span><span class="PUNC">(</span><span class="NAME">sPurchaseId</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 70</span> </span><span class="WHIT">					</span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 71</span> </span><span class="WHIT">				</span><span class="KEYW">default</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">alert</span><span class="PUNC">(</span><span class="NAME">oError.msg</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 72</span> </span><span class="WHIT">				</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 73</span> </span><span class="WHIT">			</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 74</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 75</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 76</span> </span><span class="WHIT">	</span><span class="WHIT">
<span class='line'> 77</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'> 78</span> 	 * 스크랩하기 레이어를 노출한다.
<span class='line'> 79</span> 	 * @param {Array} sArticleId 기사 아이디 목록
<span class='line'> 80</span> 	 */</span><span class="WHIT">
<span class='line'> 81</span> </span><span class="WHIT">	</span><span class="NAME">show</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">sArticleId</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 82</span> </span><span class="WHIT">		</span><span class="NAME">this._initPopupLayer</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 83</span> </span><span class="WHIT">		</span><span class="NAME">this._requestScrapArticle</span><span class="PUNC">(</span><span class="NAME">sArticleId</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 84</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 85</span> </span><span class="WHIT">	</span><span class="WHIT">
<span class='line'> 86</span> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 87</span> 
<span class='line'> 88</span> </span><span class="NAME">nhn.newsstand.common.ScrapArticle.oHTML</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="WHIT">
<span class='line'> 89</span> </span><span class="WHIT">	</span><span class="STRN">'&lt;div class="ly_cont ly_type2">'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 90</span> </span><span class="WHIT">		</span><span class="STRN">'&lt;strong class="tit">스크랩&lt;/strong>'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 91</span> </span><span class="WHIT">		</span><span class="STRN">'&lt;div class="txt_area3">'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 92</span> </span><span class="WHIT">			</span><span class="STRN">'&lt;p>&lt;strong>스크랩 되었습니다.&lt;/strong>&lt;/p>'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 93</span> </span><span class="WHIT">		    </span><span class="STRN">'&lt;p class="txt">&#39;스크랩&#39;의&lt;em>&#39;내폴더&#39;&lt;/em>에 저장되었습니다.&lt;br>&lt;em>&#39;스크랩&#39;&lt;/em>에서 스크랩한 기사를 모두 확인할 수 있고,&lt;br>폴더를 관리할 수 있습니다.&lt;/p>'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 94</span> </span><span class="WHIT">		</span><span class="STRN">'&lt;/div>'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 95</span> </span><span class="WHIT">		</span><span class="STRN">'&lt;div class="btn_area">'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 96</span> </span><span class="WHIT">			</span><span class="STRN">'&lt;a href="/scrap/index.nhn" class="scrap">&lt;span class="blind">스크랩 바로가기&lt;/span>&lt;/a>'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 97</span> </span><span class="WHIT">			</span><span class="STRN">'&lt;a href="#" class="clse _close">&lt;span class="blind">닫기&lt;/span>&lt;/a>'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 98</span> </span><span class="WHIT">		</span><span class="STRN">'&lt;/div>'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 99</span> </span><span class="WHIT">	</span><span class="STRN">'&lt;/div>'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>100</span> </span><span class="WHIT">	</span><span class="STRN">'&lt;a href="#" class="close _close">&lt;span class="blind">닫기&lt;/span>&lt;/a>'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>101</span> </span><span class="WHIT">	</span><span class="STRN">'&lt;div class="shadow">&lt;/div>'</span><span class="WHIT">
<span class='line'>102</span> </span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">join</span><span class="PUNC">(</span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">;</span></pre></body></html>